{/include file="simpla/common/header.html"/}
{/include file="simpla/common/left.html"/}
<div id="main-content">
  <h2>欢迎您 {/$_adminname/}</h2>
  <p id="page-intro">会员管理。</p>
  <div class="clear"></div>
  <div class="content-box">
    <div class="content-box-header">
      <h3>会员管理</h3>
      <ul class="content-box-tabs">
        {/if $ac=="rog"/}
        <li><a href="{/get_url rule='/member/memberinfo-mid/}-{/$mid/}.html" title="购买记录">购买记录</a></li>
        <li><a href="#tab1" class="default-tab">退货记录</a></li>
        <li><a href="{/get_url rule='/member/exlog-mid/}-{/$mid/}.html" title="兑换记录">兑换记录</a></li>
        <li><a href="{/get_url rule='/member/editmember-mid/}-{/$mid/}.html" title="编辑">资料编辑</a></li>
        {/elseif $ac=="ex" /}
        <li><a href="{/get_url rule='/member/memberinfo-mid/}-{/$mid/}.html" title="购买记录">购买记录</a></li>
        <li><a href="{/get_url rule='/member/memberinfo-ac-rog-mid/}-{/$mid/}.html" title="购买记录">退货记录</a></li>
        <li><a href="#tab1" class="default-tab">兑换记录</a></li>
        <li><a href="{/get_url rule='/member/editmember-mid/}-{/$mid/}.html" title="编辑">资料编辑</a></li>
        {/else/}
        <li><a href="#tab1" class="default-tab">购买记录</a></li>
        <li><a href="{/get_url rule='/member/memberinfo-ac-rog-mid/}-{/$mid/}.html" title="购买记录">退货记录</a></li>
        <li><a href="{/get_url rule='/member/exlog-mid/}-{/$mid/}.html" title="兑换记录">兑换记录</a></li>
        <li><a href="{/get_url rule='/member/editmember-mid/}-{/$mid/}.html" title="编辑">资料编辑</a></li>
        {//if/}
      </ul>
      <div class="clear"></div>
    </div>
    <style>
	.memberinfo{ line-height:22px;}
	.memberinfo span{ margin-right:20px;} 
	.buttonred{color:#C00; border:1px solid #C00; border-radius:3px; padding:0px 3px;}
	.buttonred:hover{ color:#FFF; background:#D00;}
#targetBox{ position: absolute; z-index:1111111111; width:100%; top:1px;}
#target{  height:20px; padding:10px; margin:0 auto; width:200px; background:rgba(237,200,126,0.5); display:none; border:1px solid #cfa34a; border-radius:3px; color:#C00; }
	</style>
    <div class="content-box-content">
      <div class="tab-content default-tab" id="tab1">
        <div class="form" style="width:50%; float:left;"> {/if $ac=="rog"/}
          <form id="js-form" method="post" action="{/get_url rule='/member/memberinfo-ac-rog-mid/}-{/$mid/}.html">
          {/elseif $ac=="ex" /}
          <form id="js-form" method="post" action="{/get_url rule='/member/exlog-mid/}-{/$mid/}.html">
          {/else/}
          <form id="js-form" method="post" action="{/get_url rule='/member/memberinfo-mid/}-{/$mid/}.html">
            {//if/}
            <fieldset class="clearfix">
              <p>开始时间： <span>
                <input type="text" value="{/$stime/}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="text-input min-input" name="stime" />
                </span>&nbsp;结束时间： <span>
                <input type="text" value="{/$etime/}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="text-input min-input" name="etime" />
                </span><small>(格式：2012-01-01)</small> </p>
              <p>关键字：<span>
                <input type="text" value="{/$key/}" class="text-input small-input" name="key" />
                &nbsp;<small>商品名称，订单号</small>&nbsp;
                <input type="submit" name="" id="button" class="button" value="查询" />
                </span> </p>
            </fieldset>
          </form>
        </div>
        <div style="width:50%; float:left;" class="memberinfo"><span>会员姓名：{/ $member.realname /}</span><span>会员等级：{/ $member.grade /}级</span><br>
          <span>会员卡号：{/ $member.membercardid /}</span><span>身份证号：{/ $member.cardid /}</span><br>
          <span>联系电话：{/ $member.phone /}</span><br>
          <span>消费总额：{/ $m_cache.totalspanding /} 元</span><span>退款总额：{/ $m_cache.totalrefund /} 元</span> <span>购买次数：{/ $m_cache.buyfre /} 次</span><span>退货次数：{/ $m_cache.returnfre /} 次</span><br>
          <span>会员积分：{/ $member.credit /} 分 <a href="#creditbox" onClick="" id="crdtool" class="buttonred">兑换</a></span><span>已兑积分：{/ $m_cache.exchangecredit /} 分</span><br>
          <span>注册日期：{/ 'Y-m-d H:i'|date:$member.regdateline /}</span><span>最后购买日期：{/ 'Y-m-d H:i'|date:$member.lastdateline /}</span><br>
          <div style="display:none;">
            <div id="creditbox">
              <div id="targetBox">
                <p id="target"></p>
              </div>
              <form>
                <input type="text" value="" class="text-input" id="excredit" onKeyUp="excrd(this.value)" onChange="" name="excredit" />
                <input type="button"name="" id="exbutton" class="button" value="兑换" />
                <br>
                <p>现有积分：{/ $member.credit /} 分，可以兑换人民币：{/ $member.credit*$tormb /}元</p>
                当前输入的积分可以兑换：<span id="yuan">0</span>元
              </form>
            </div>
          </div>
          <script>
 var tormb={/$tormb/};
 var credit={/ $member.credit /};
$('#crdtool').colorbox({
    inline: true,
    width: "330px",
    height: "130px"
});
 function excrd(crd){
	 if(crd>credit){alert('没有那么多积分！');return false;}
	 $('#yuan').html(decimal(crd*tormb,3));
 }
$('#exbutton').click(function(){
	$.post("{/get_url rule='/member/ajaxex-mid/}-{/$mid/}",{excredit:$('#excredit').val()},function(data){shownote(data,function(){$.colorbox.close();location.reload();},3000);});
	});
function shownote(msg,fn){
	 $('#target').html(msg).slideDown(150,function(){setTimeout(function(){$('#target').slideUp(100,fn);},1000);});
	 }
</script> 
        </div>
        <div class="clear"></div>
        <hr />
        <table>
          <thead>
          
          {/if $ac=="ex" /}
          <tr>
            <th>兑换积分</th>
            <th>兑换金额</th>
            <th>兑换商品</th>
            <th>兑换时间</th>
            </tr>
          {/else/}
          <tr>
            <th>订单号</th>
            <th>名称</th>
            <th>数量</th>
            <th>实际售价</th>
            <th>优惠(促销/会员)</th>
            <th>退款</th>
            <th>销售时间</th>
            {/if $ac!="rog"/}
            <th>操作</th>
            {//if/} </tr>
          {//if/}
            </thead>
          
          <tfoot>
            <tr>
              <td colspan="7">{/$pagebar/}</td>
            </tr>
          </tfoot>
          <tbody>
          
          {/if $ac=="ex" /}
          
          {/section name=i loop=$sales/}
          <tr>
            <td>{/$sales[i].excredit/}</td>
            <td>{/$sales[i].exrmb/}</td>
            <td>{/$sales[i].goodsid/}</td>
            <td>{/ "Y-m-d H:i:s"|date:$sales[i].extime/}</td>
          </tr>
          {/sectionelse/}
          <tr>
            <td colspan="8" align="center">没有数据</td>
          </tr>
          {//section/} 
          {/else/}
          {/section name=i loop=$sales/}
          <tr>
            <td><a href="{/get_url rule='/sales/out-ac-p-oid'/}-{/$sales[i].order_id/}.html?ajax=1" class="ajax">{/$sales[i].order_id/}</a></td>
            <td>{/$sales[i].goods_name/}</td>
            <td>{/$sales[i].num/}</td>
            <td>{/$sales[i].price*$sales[i].num/}</td>
            <td>{/if $sales[i].p_discount gt 0/}{/$sales[i].p_discount /}元{/else/}无{//if/}/{/if $sales[i].m_discount gt 0/}{/$sales[i].m_discount /}元{/else/}无{//if/}</td>
            <td>{/if $sales[i].refund_type eq 0/}无退款{/else/}{/$sales[i].refund_amount/}元{//if/}</td>
            <td>{/$sales[i].dateymd/}</td>
            {/if $ac!="rog"/}
            <td><a href="{/get_url rule='/sales/return-ac-member-orderid/}-{/$sales[i].order_id/}-mid-{/$mid/}.html" title="退货">退货</a></td>
            {//if/} </tr>
          {/sectionelse/}
          <tr>
            <td colspan="8" align="center">没有数据</td>
          </tr>
          {//section/}
          {//if/}
            </tbody>
          
        </table>
      </div>
    </div>
  </div>
  {/include file="simpla/common/copy.html"/} </div>
{/include file="simpla/common/footer.html"/}